<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<div>
		<ul id="food">
			<li>馒头</li>
			<li>包子</li>
			<li>面板</li>
		</ul>
	</div>
	<script>

		var ul = document.getElementById("food");
		
		var lis = ul.getElementsByTagName("li");

		for(var i  = 0;i<lis.length;i++){

			lis[i].onclick = function(){

				var b = this.innerHTML;

				console.log(b);

			}
		}

	</script>
</body>
</html>